﻿<?php include("conn.php") ?>
<?php
/*if($_GET["Type"]=="Del"){
	@mysql_query("delete from company_shop where id=".$_GET["id"]);
	GoLink("system-page.php");
	}else*/ if($_POST["Type"]=="Edit"){
			$conn=new Mysql();
			$sql="update company_shop set title='".$_POST["title"]."',title_f='".$_POST["title_f"]."',urls='".$_POST["urls"]."',content='".$_POST["myContent"]."',adpic='".$_POST["adpic"]."' where id=".$_POST["id"];
			//echo $sql;
			//exit;
    if($conn->query($sql)){
						OutErrorBack("修改完成","system-page.php");
				}else{
					OutErrorBack("系统繁忙","system-page.php");
					}

		}
?>
<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<?php include("public/cssjs.php");?>
<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
<!--/meta 作为公共模版分离出去-->
<title>基本设置</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
	<span class="c-gray en">&gt;</span>
	系统管理
	<span class="c-gray en">&gt;</span>
	单篇固定内容模块
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>

<div class="page-container">
	 <?
     $conn=new Mysql();
	$sql = "select * from company_shop  order by id asc";
	$page_size = 20;					 //定义每页显示多少记录
     $num_cnt = mysqli_num_rows($conn->query($sql)); //获取总记录数
	$page_cnt = ceil($num_cnt/$page_size);  //计算总页数	
	if(isset($_GET["page"])){
		$page = intval($_GET["page"]);
	}else{
		$page = 1;
	}
    if ($page<1)
	{
        $page=1;
	}
    elseif ($page>$page_cnt)
	{
        $page=$page_cnt;
    }
	$query_start = ($page - 1 ) * $page_size;   //计算每页开始的记录号
	$query_sql = $sql." limit $query_start,$page_size"; //使用limit获取记录

?>
<table class="table table-striped table-hover table-bordered" id="editable-sample">
  <tr bgcolor="#799AE1" class="blueLine">
    <td width="140">栏目标题</td>
    <td width="200">内容位置</td>
    <td width="400" >简略标题</td>
    <td >链接地址</td>
    <td>操作</td>
  </tr>
<?
if($num_cnt>0)
{
    $row=$conn->getAll($query_sql);
    foreach($row as $key=>$rs){
?>
  <tr onMouseOver="this.style.backgroundColor='#F3F3F3'" onMouseOut="this.style.backgroundColor='#FFFFFF'">
	  <td align="center">&nbsp;<b><?php echo $rs["title"]; ?></b></td>
	  <td height="22"><div align="center">&nbsp;<?php echo $rs["cssname"]; ?></div></td>
      <td height="22"><div align="center">&nbsp;<?php echo $rs["title_f"]; ?></div></td>
      <td height="22"><div align="center">&nbsp;<?php echo $rs["urls"]; ?></div></td>
	  <td style="text-align:center">
      <a style="text-decoration:none" class="ml-5" href="system-page.php?Type=Edit&id=<?php echo $rs["id"];?>" title="编辑"><i class="Hui-iconfont">&#xe6df;</i></a> <!--<a style="text-decoration:none" class="ml-5" href="system-page.php?Type=Del&id=<?=$rs["id"]?>" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a>-->
     </td>
	</tr>
<?php
	}
}else{
?>
  <tr onMouseOver="this.style.backgroundColor='#F3F3F3'" onMouseOut="this.style.backgroundColor='#FFFFFF'">
    <td height="22" colspan="3" align="center" style="color:#FF0000;">暂无信息</td>
  </tr>  
<?php
}
?>
 
</table>
                         
                     </section>
                        <section>
                     <form method="post" action="system-page.php" name="form1">
                     <?php
                     if(isset($_GET["id"])){$pid=$_GET["id"];}else{$pid=46;}
                     $conn=new Mysql();
					 $rs=$conn->getRow("select * from company_shop where id=".$pid);
					 if($_GET["id"]!=""){ $typere="Edit";}else{$typere="add";}
					 ?>
                     <input type="hidden" name="Type" value="<?php echo $typere;?>">
                     <table class="table table-bordered">
                     <input type="hidden" name="id" value="<?php echo $pid;?>">
  
   <tr >
    <td align="right" width="140" >栏目标题：</td>
    <td ><input name="title"  value="<?php echo $rs["title"];?>"  class="input-text"  type="text" size="100" /></td>
  </tr>
   <tr >
    <td align="right" width="140" >副标题：</td>
    <td ><input name="title_f"  value="<?php echo $rs["title_f"];?>"  class="input-text"  type="text" size="100" /></td>
  </tr>
  <tr >
    <td align="right" >跳转地址：</td>
    <td ><input name="urls"  value="<?php echo $rs["urls"];?>"   class="input-text" type="text" size="100" /></td>
  </tr>
  <? if($rs["adpic"]!=""){
	  ?>
	  <tr><Td></Td><td><img src="/pic/<?php echo $rs["adpic"];?>" width="200" ></td></tr>
	  <?
	  }?>
  <tr >
    <td align="right" >附图：</td>
    <td ><iframe 
      src="../pic/images_UP.php?bd=adpic&form=form1" name="key" width="448" 
      height="30" marginheight="0" scrolling="No" frameborder="0" id="key">IE</iframe><input name="adpic"  value="<?php echo $rs["adpic"];?>"   class="input-text" id="adpic" type="text" size="100" /></td>
  </tr>
  <tr >
    <td align="right" >内容：</td>
    <td >
    <textarea id="editor" style="width:100%;height:400px;" name="myContent"><?php echo $rs["content"];?></textarea>
<script type="text/javascript">
    var editor = new baidu.editor.ui.Editor();
    editor.render("editor");
</script>
    </td>
  </tr>
  <tr>
    <td colspan="2" align="center" bgcolor="#FFFFFF"><input name="Submit" type="submit" class="btn btn-xs btn-danger" value="　保  存　">　　　</td>
    </tr>
 
 </table>
                     </form>
                     </section>
                     
</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/h-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/h-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" src="lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
$(function(){
		var ue = UE.getEditor('editor');
	
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	$("#tab-system").Huitab({
		index:0
	});
	$("#btn-star").click(function(){
		var files=$("#file-2").val();
		$.get("json/upload.php?files="+files,function(data){
			alert(data);
			})
		})
});
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
